// const s = new Set([1,2,3,2,1]);
// const s1 = new Set('aaabbb');
// console.log(s);
// console.log(s1);

// let arr = [...s];
// let arr1 = [...s1];

// console.log(arr);
// console.log(arr1);

// let r =  Array.from(s);
// let r1 = Array.from(s1);
// console.log(r);
// console.log(r1);


// let set = new Set();
// set.add(5);
// set.add('5');
// console.log(set);
// console.log(set.size);
// console.log(set.has(1));
// console.log(set.has(5));

console.log('--------------------');


//求并集
let arr1 = [1,2,3,4];
let arr2 = [2,3,4,5];
let a = new Set(arr1);
let b = new Set(arr2);

let bingSet = new Set([...a,...b]);
console.log(bingSet);


//求交集
let jiaoSet = new Set([...a].filter(x=>b.has(x)));
console.log(jiaoSet);


//求差集
let chaSet = new Set([...a].filter(x=>!b.has(x)));
console.log(chaSet);



let map = new Map();
map.set('k1',123);
map.set('k2',{name:'zhangsan',age:18});

console.log(map.keys());
console.log(map.get('k2'));
